<template>
  <!--1-->
  <van-tabbar v-model="active">
    <!--2-->
    <van-tabbar-item name="/home" icon="notes-o" @click="link('/home')">明细</van-tabbar-item>
    <van-tabbar-item name="/data" icon="bar-chart-o" @click="link('/data')">统计</van-tabbar-item>
    <van-tabbar-item name="/user" icon="user-o" @click="link('/user')">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script setup lang="ts">
import { ref, defineProps, onMounted } from "vue";
import { useRouter } from "vue-router";
defineProps({
  msg: String,
});
const router = useRouter();

//高亮
const active = ref();

onMounted(() => {
  active.value = router.currentRoute.value.path;
});

function link(path: string) {
  router.push(path);
}
</script>
